﻿

namespace WindowsAPI.Windows
{
    public partial class WindowSystemInfoControl : WindowViewerControl
    {
        public WindowSystemInfoControl() { InitializeComponent(); }

        public override void Clear()
        {
            base.Clear();

            f_Handle_TextBox.Clear();
            f_WindowClass_TextBox.Clear();
            f_WindowText_TextBox.Clear();
            f_WindowText_TextBox.ReadOnly = false;
            f_Hint.RemoveAll();
        }

        public override void View(Window w)
        {
            base.View(w);

            if(w == null) return;

            f_Handle_TextBox.Text = w.Handle.ToString();
            f_WindowClass_TextBox.Text = w.ClassName;
            f_WindowText_TextBox.Text = w.Text;
            f_Hint.SetToolTip(f_Handle_TextBox,
                string.Format("{0}\r\n{1}",
                    "PID", w.ProcessId));
            f_Hint.SetToolTip(f_WindowClass_TextBox, f_WindowClass_TextBox.Text);
            f_Hint.SetToolTip(f_WindowText_TextBox, f_WindowText_TextBox.Text);
        }
    }
}
